#!/bin/bash
# cp /mnt/ssd/android-build-ffmpeg/lpp_tran.cpp /mnt/ssd/build/fdk-aac-2.0.3/libSBRdec/src/lpp_tran.cpp
mypwd=$(pwd)

#你的NDK目录

#你自己的NDK路径。
export ANDROID_NDK=$mypwd/android-ndk-r21e
# 设置你的android平台编译器的版本
export SYSROOT=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/sysroot
#编译使用的toolchain
export TOOLCHAIN=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64
export CPU=aarch64 # 我是基于 armv8-a的 cpu编译的
# export CPU=armv8-a # 一定不要填 armv8-a 因为根本就没有 armv8-a-linux-android21-clang
export API=23 
# /mnt/ssd/android-build-ffmpeg/android-ndk-r21e/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin
CROSS_PREFIX=$TOOLCHAIN/bin/aarch64-linux-android-
export CC=$TOOLCHAIN/bin/aarch64-linux-android$API-clang
export CXX=$TOOLCHAIN/bin/aarch64-linux-android$API-clang++
# 这个是输出的路径 
export PREFIX=$mypwd/lib/$CPU
export libs="${mypwd}/lib/aarch64/lib"
export PKG_CONFIG_PATH="${libs}/lib/pkgconfig"
export ADDI_CFLAGS="-DBIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD"
cd fdk-aac-2.0.3
# 编译 fdk-aac-2.0.3
./configure \
--prefix=$PREFIX \
--enable-shared \
--disable-static \
--enable-example \
--enable-pic \
--disable-asm \
--disable-cli \
--host=arm-linux \
cc=$CC \
cxx=$CXX \
CPPFLAGS="-fPIC"
make -j4
make install
